<?php


namespace App\Model;


use Hyperf\Database\Model\Relations\HasMany;
use Hyperf\Database\Model\Relations\HasOne;

class Group extends Model
{
    protected $fillable = ['user_id', 'name'];

    public function group_users(): HasMany
    {
        return $this->hasMany(GroupUser::class, 'group_id', 'id');
    }

    public function user(): HasOne
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }
}